package com.example.recyclerviewproject;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class MyAdapter3 extends RecyclerView.Adapter<MyAdapter3.MyViewHolder> {
   private Context mContext;
   private LayoutInflater inflater;
   private List<ItemBean> list;

   public  MyAdapter3(Context context){
       this.mContext=context;
       inflater= LayoutInflater.from(context);

   }
   public void setItemBeanList(List<ItemBean> list){
       this.list=list;
   }


    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//        LayoutInflater inflater = LayoutInflater.from(mContext);
        View itemView = inflater.inflate(R.layout.list_item_layout, parent, false);
        MyViewHolder myViewHolder = new MyViewHolder(itemView);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        TextView titleTv = holder.title_tv;
        ItemBean itemBean = list.get(position);
        String title = itemBean.getTitle();
        titleTv.setText(title);


    }

    @Override
    public int getItemCount() {
        return 0;
    }

    public class MyViewHolder extends  RecyclerView.ViewHolder{
        private ImageView icon_img;
        private TextView title_tv;
        private TextView content_tv;
        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            icon_img= itemView.findViewById(R.id.icon_img);
            title_tv=itemView.findViewById(R.id.title_tv);
            content_tv= itemView.findViewById(R.id.content_tv);
        }
    }


}
